const babelCore = require('@babel/core')

const code = `
    let foo = 'foo'
    let bar = 'bar'
    var obj = {
        ["x" + foo]: "heh",
        ["y" + bar]: "noo"
    };
`
const result = babelCore.transformSync(code,{
    plugins: ["@babel/plugin-transform-computed-properties"]
})

console.log(result.code);